
<?php
defined('_JEXEC') or die('Restricted access');
date_default_timezone_set('Asia/Ho_Chi_Minh');
JTable::addIncludePath ( JPATH_COMPONENT. DS . 'tables' );
$user = JFactory::getUser();
$app = &JFactory::getApplication();
if($user->id != '')
{
    if($user->get('isRoot')==1)
    {
        $app->redirect('index.php?option=com_admin');
                return;
    }
    else
    {
        return;
    }
}
else{
            $view = JRequest::getCmd( 'view', 'dashboard' );

            switch ($view) {

                    case 'dashboard':

                            $controllerName = 'dashboard';

                    break;

                    case 'items':

                            $controllerName = 'items';

                    break;

                    default:

                            $controllerName = $view;

            }
            
            require_once( JPATH_COMPONENT.DS.'controllers'.DS.$controllerName.'.php' );

            $controller = new loginController();

            $controller->execute( JRequest::getCmd('task') );

            $controller->redirect();
    
}
    
?>